package com.example.ecommerce.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.ecommerce.entity.ProductSpec;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface ProductSpecMapper extends BaseMapper<ProductSpec> {
    /**
     * 检查商品是否存在
     */
    @Select("SELECT COUNT(*) > 0 FROM products WHERE id = #{productId} AND is_deleted = 0")
    boolean existsProduct(@Param("productId") Long productId);
} 